﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using RayDen.RayEngine;
using RayDen.RayEngine.Core;
using RayDen.RayEngine.Core.Interface;
using RayDen.RayEngine.Managers;

namespace RayEngine.Spectral.Engine
{
    public class SpectralRenderThread : GenericDeviceRenderThreadBase<PathBuffer, IImageFilm>
    {
        protected internal SceneManager SceneManager;
        public SpectralRenderThread(int index, RayEngineScene scene) : base(index, scene)
        {
        }

        public SpectralRenderThread(int index, IIntersectionEngine device, RayEngineScene scn,
                                    bool lowLatency, IImageFilm pixelDevice, 
                                    SamplingContext sc, IFrameManager fM, SceneManager scm) : base(index, device, scn, lowLatency, pixelDevice, sc, fM)
        {
            SceneManager = scm;
        }

        protected override PathBuffer CreatePathBuffer(int maxPath, RayEngineScene scene, IImageFilm pixelDevice, SamplingContext sc)
        {
            var pathBuffer = new PathBuffer()
            {
                Sampler = sc.PrimarySpaceSampler,
                SceneManager = SceneManager??EngineConfiguration.Instance.SceneManager
            };
            pathBuffer.Init(maxPath, scene, pixelDevice, sc);
            return pathBuffer;
        }

    }
}
